<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">

    <button type="button" class="layui-btn" id="test4"><i class="layui-icon"></i>上传文件</button>
    <button id="down" type="button" class="layui-btn layui-btn-primary">下载流水模板</button>
</div>
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
<br>
<script src="/static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="/static/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
<script>

    $("#down").click(function(){
        window.location.href="/excel/down.html"
    })
    layui.use(['form', 'table','upload'], function() {
        var $ = layui.jquery,
            table = layui.table,
            upload = layui.upload;
        upload.render({ //允许上传的文件后缀
            elem: '#test4'
            ,url: '/excel/upload' //改成您自己的上传接口
            ,accept: 'file' //普通文件
            ,exts: 'xlsx' //只允许上传xlsx文件
            ,done: function(res){
                layer.msg('上传成功');
                console.log(res)
                //table reload()
                table.reload('currentTableId',{data:res.data})
            }
        });


        table.render({
            elem: '#currentTableId',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print'],
            cols: [[
                {field: 'secuName', align: 'center',width: 110, title: '交易编号', sort: true},
                {field: 'type', align: 'center',width: 100, title: '交易方向'},
                {field: 'secuCode', align: 'center',width: 110, title: '交易日期', sort: true},
                {field: 'direction', align: 'center',width: 100, title: '交易市场'},
                {field: 'dealDate', align: 'center',width: 110, title: '债券代码', sort: true},
                {field: 'gdSecuCode', align: 'center',width: 110, title: '债券名称', sort: true},
                {field: 'dealNumber', align: 'center',width: 140, title: '成交金额(万)', sort: true},
                {field: 'amount', align: 'center',width: 140, title: '卷面金额(万)', sort: true},
                {field: 'avgPrice', align: 'center',width: 140, title: '成交均价(万)', sort: true},
                {field: 'dealPaySum', align: 'center',width: 140, title: '成交均价(万)', sort: true},
                {field: 'payFee', align: 'center',width: 140, title: '成交均价(万)', sort: true},
                {field: 'dealTime', align: 'center',width: 140, title: '成交均价(万)', sort: true}
                ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            size: "sm"
        });
    })
</script>
</body>
</html>